home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr29 / memsize.zip / RESTRING.CPP < prev    next >
C/C++ Source or Header  |  1995-01-04  |  852b  |  43 lines

  1. // Class RESTRING: Encapsulates the load/discard
  2. //   logic for a resource String Table entry.
  3.  
  4. #define INCL_BASE
  5. #include <os2.h>
  6.  
  7. #include "debug.h"
  8.  
  9. #include "restring.h"
  10.  
  11. //#define DEBUG
  12.  
  13.  
  14.   // Constructor
  15.  
  16. ResourceString::ResourceString ( HMODULE Module, ULONG Id )
  17. {
  18.   SavedModule = Module ;
  19.   SavedId = Id ;
  20.  
  21.   APIRET Status = DosGetResource ( Module, RT_STRING, Id/16+1, &BlockPointer ) ;
  22.   if ( Status )
  23.   {
  24.     #ifdef DEBUG
  25.     Log (
  26.       "ERROR: Unable to get string resource."
  27.       "  Module %lu, id %lu, code %08lX.\r\n", SavedModule, SavedId, Status ) ;
  28.     #endif
  29.     return ;
  30.   }
  31.  
  32.   StringPointer = PBYTE(BlockPointer) + sizeof(USHORT) ;
  33.  
  34.   USHORT Index = (USHORT) ( Id % 16 ) ;
  35.   while ( Index-- )
  36.   {
  37.     StringPointer += *StringPointer ;
  38.     StringPointer ++ ;
  39.   }
  40.  
  41.   StringPointer ++ ;
  42. }
  43.